<template>
	<view class="header-bar">
		<image @click="back" :src="color === 'white' ? leftArrowWhite : leftArrowBlack " mode=""></image>
		<image @click="more" v-if="moreShow" :src="moreIcon" mode=""></image>
	</view>
</template>

<script>
	import {more_icon,left_arrow_white, black_arrow_left} from '@/static/svg/index.js'
	export default {
		name: 'HeaderBar',
		props: {
			moreShow: {
				type: Boolean,
				default: false
			},
			color: {
				type: String,
				default: 'white'
			}
		},
		data () {
			return {
				moreIcon: more_icon,
				leftArrowWhite: left_arrow_white,
				leftArrowBlack: black_arrow_left
			}
		},
		methods: {
			back () {
				uni.navigateBack({
					animationDuration: 300,
					animationType: 'pop-out'
				})
			},
			more () {
				this.$emit('more')
			}
		}
	}
</script>

<style lang="less" scoped>
	.header-bar {
		position: fixed;
		left: 0;
		top: 0;
		z-index: 2;
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		padding: 0 40upx;
		padding-top: 108upx;
		box-sizing: border-box;
		image {
			width: 48upx;
			height: 48upx;
		}
	}
</style>
